#include <bits/stdc++.h>

using namespace std;

//https://leetcode-cn.com/contest/weekly-contest-208

class Solution {
public:
    int minOperations(vector<string>& logs) {
        int len=logs.size();
        stack<string> s;
        for(int i=0;i<len;i++){
            if( logs[i].size()>=3 &&logs[i].substr(0,3)=="../"){
                if(!s.empty()) s.pop();
            }else if(logs[i].size()>=2 &&logs[i].substr(0,3)=="./"){
            }else{
                s.push(logs[i]);
            }
        }
        return s.size();
    }
};

int main(){
#ifdef DEBUG
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
    vector<string> v={"./","../","./"};
    Solution s;
    cout << s.minOperations(v) <<endl;

    return 0;
}